package com.feeyo.groundservice.usbserial

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.appcompat.app.AppCompatActivity


/**
 *作者：70893 on 2024-11-10
 *描述：usb 串口基类
 */
abstract class BaseUsbSerialActivity : AppCompatActivity() {


    init {
        UsbSerialImp.init(this)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        UsbSerialImp.onCreate()
        //基本参数配置
        UsbSerialImp.setPackage(packageName)
            .setWithIoManager(true)
            .setBaudRate(19200)
            .setCanEnable(true)
    }

    override fun onStart() {
        super.onStart()
        UsbSerialImp.onStart()
    }

    override fun onStop() {
        super.onStop()
        UsbSerialImp.onStop()
    }

    override fun onResume() {
        super.onResume()
        UsbSerialImp.onResume()
    }

    override fun onPause() {
        super.onPause()
        UsbSerialImp.onPause()
    }

    override fun onDestroy() {
        super.onDestroy()
        UsbSerialImp.setCanEnable(false)
        UsbSerialImp.onDestroy()
    }
}